#include "qe_operator.h"
#include "qe_vars.h"


struct q_variable q_op_negate(struct q_variable* arg)
{
	/* ! */
	int i;
	if(arg->constant)
		/* fatal: trying to change constant */;
	switch(arg->type)
	{
		case VAR_BOOL:
		case VAR_INT:
			arg->data.i = !arg->data.i;
			return *arg;
		/* etc etc... */
		/* etc etc... */
		/* etc etc... */
		/* etc etc... */
		case VAR_STRUCT:
			/* fatal */
		case VAR_ARRAY:
			if(arg->data.array.length)
			{
				for(i = 0; i < arg->data.array.length; ++i)
				{
					//q_op_negate();
				}
			}
			return *arg;
		case VAR_STRING:
			if(arg->data.string.length)
				for(i = 0; i < arg->data.string.length; ++i)
				{
					if(arg->data.string.chars[i] >= 'a' && arg->data.string.chars[i] <= 'z')
						arg->data.string.chars[i] += 'A' - 'a';
					else if(arg->data.string.chars[i] >= 'A' && arg->data.string.chars[i] <= 'Z')
						arg->data.string.chars[i] += 'a' - 'A';
				}
			return *arg;
		default:
			break;
	}
	/* fatal */
	return *arg;
}

struct q_variable q_op_add(struct q_variable* arg1, struct q_variable* arg2)
{
	/* += */
	if(arg1->constant)
		/* fatal: trying to change constant value */;
	if(arg1->type == VAR_STRUCT || arg2->type == VAR_STRUCT)
		/* fatal: trying to add struct */;
	switch(arg1->type)
	{
		case VAR_BOOL:
			/* fatal */;
		case VAR_INT:
			/* etc etc... */
			break;
		default:
			break;
	}
	return *arg1;
}
